CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(test_sdk)
set(TARGET_NAME test)

set(PCL "TRUE")


SET(CMAKE_CXX_STANDARD "17")
SET(CMAKE_C_STANDARD "17")

list( APPEND LIST_DIR  "src")

foreach( dir  ${LIST_DIR} )
    message( STATUS ${dir})
    FILE( GLOB  SRC_LIST "${PROJECT_SOURCE_DIR}/${dir}/*.cpp")
    list(APPEND ALL_SRC_LIST ${SRC_LIST})
    include_directories(AFTER ${dir})
endforeach()

include_directories(AFTER "${PROJECT_SOURCE_DIR}/lib")

link_directories(AFTER "${PROJECT_SOURCE_DIR}/lib")

add_executable( ${TARGET_NAME} ${ALL_SRC_LIST})
target_link_libraries(${TARGET_NAME} eds_tof_sdk pthread)

if("${PCL}" STREQUAL "TRUE")
    find_package(PCL 1.2 REQUIRED COMPONENTS common io)
    include_directories(${PCL_INCLUDE_DIRS})
    link_directories(${PCL_LIBRARY_DIRS})
    add_definitions(${PCL_DEFINITIONS})
    target_link_libraries(${TARGET_NAME} ${PCL_LIBRARIES})
    add_definitions(-DPCL)
endif()

find_package(OpenCV REQUIRED)
# find_package(OpenCV 4.5 REQUIRED COMPONENTS core imgproc features2d)
if (OpenCV_FOUND)
    MESSAGE(STATUS "OpenCV_VERSION: " ${OpenCV_VERSION})
    MESSAGE(STATUS "OpenCV_INCLUDE_DIRS: " ${OpenCV_INCLUDE_DIRS})
    MESSAGE(STATUS "OpenCV_LIBS: " ${OpenCV_LIBS})
endif()
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${OpenCV_LIBS})
